/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.taobao.ibatiside.model.configv2.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;

import org.taobao.ibatiside.model.configv2.Configv2Package;
import org.taobao.ibatiside.model.configv2.PropertiesType;
import org.taobao.ibatiside.model.configv2.ResultObjectFactoryType;
import org.taobao.ibatiside.model.configv2.SettingsType;
import org.taobao.ibatiside.model.configv2.SqlMapConfigType;
import org.taobao.ibatiside.model.configv2.SqlMapType;
import org.taobao.ibatiside.model.configv2.TransactionManagerType;
import org.taobao.ibatiside.model.configv2.TypeAliasType;
import org.taobao.ibatiside.model.configv2.TypeHandlerType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sql Map Config Type</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getGroup <em>Group</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getProperties <em>Properties</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getSettings <em>Settings</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getResultObjectFactory <em>Result Object Factory</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getTypeAlias <em>Type Alias</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getTypeHandler <em>Type Handler</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getTransactionManager <em>Transaction Manager</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.configv2.impl.SqlMapConfigTypeImpl#getSqlMap <em>Sql Map</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SqlMapConfigTypeImpl extends EObjectImpl implements SqlMapConfigType {
	/**
	 * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getGroup()
	 * @generated
	 * @ordered
	 */
	protected FeatureMap group;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SqlMapConfigTypeImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Configv2Package.Literals.SQL_MAP_CONFIG_TYPE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureMap getGroup() {
		if (group == null) {
			group = new BasicFeatureMap(this, Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP);
		}
		return group;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<PropertiesType> getProperties() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__PROPERTIES);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SettingsType> getSettings() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__SETTINGS);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<ResultObjectFactoryType> getResultObjectFactory() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<TypeAliasType> getTypeAlias() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<TypeHandlerType> getTypeHandler() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<TransactionManagerType> getTransactionManager() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<SqlMapType> getSqlMap() {
		return getGroup().list(Configv2Package.Literals.SQL_MAP_CONFIG_TYPE__SQL_MAP);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP:
				return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__PROPERTIES:
				return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SETTINGS:
				return ((InternalEList<?>)getSettings()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY:
				return ((InternalEList<?>)getResultObjectFactory()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS:
				return ((InternalEList<?>)getTypeAlias()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER:
				return ((InternalEList<?>)getTypeHandler()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER:
				return ((InternalEList<?>)getTransactionManager()).basicRemove(otherEnd, msgs);
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SQL_MAP:
				return ((InternalEList<?>)getSqlMap()).basicRemove(otherEnd, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP:
				if (coreType) return getGroup();
				return ((FeatureMap.Internal)getGroup()).getWrapper();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__PROPERTIES:
				return getProperties();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SETTINGS:
				return getSettings();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY:
				return getResultObjectFactory();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS:
				return getTypeAlias();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER:
				return getTypeHandler();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER:
				return getTransactionManager();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SQL_MAP:
				return getSqlMap();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP:
				((FeatureMap.Internal)getGroup()).set(newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__PROPERTIES:
				getProperties().clear();
				getProperties().addAll((Collection<? extends PropertiesType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SETTINGS:
				getSettings().clear();
				getSettings().addAll((Collection<? extends SettingsType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY:
				getResultObjectFactory().clear();
				getResultObjectFactory().addAll((Collection<? extends ResultObjectFactoryType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS:
				getTypeAlias().clear();
				getTypeAlias().addAll((Collection<? extends TypeAliasType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER:
				getTypeHandler().clear();
				getTypeHandler().addAll((Collection<? extends TypeHandlerType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER:
				getTransactionManager().clear();
				getTransactionManager().addAll((Collection<? extends TransactionManagerType>)newValue);
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SQL_MAP:
				getSqlMap().clear();
				getSqlMap().addAll((Collection<? extends SqlMapType>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP:
				getGroup().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__PROPERTIES:
				getProperties().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SETTINGS:
				getSettings().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY:
				getResultObjectFactory().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS:
				getTypeAlias().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER:
				getTypeHandler().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER:
				getTransactionManager().clear();
				return;
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SQL_MAP:
				getSqlMap().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Configv2Package.SQL_MAP_CONFIG_TYPE__GROUP:
				return group != null && !group.isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__PROPERTIES:
				return !getProperties().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SETTINGS:
				return !getSettings().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__RESULT_OBJECT_FACTORY:
				return !getResultObjectFactory().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_ALIAS:
				return !getTypeAlias().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TYPE_HANDLER:
				return !getTypeHandler().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__TRANSACTION_MANAGER:
				return !getTransactionManager().isEmpty();
			case Configv2Package.SQL_MAP_CONFIG_TYPE__SQL_MAP:
				return !getSqlMap().isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (group: ");
		result.append(group);
		result.append(')');
		return result.toString();
	}

} //SqlMapConfigTypeImpl
